﻿IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'proc_cm_SaveSiteMapNode')
BEGIN
    PRINT 'Dropping Procedure proc_cm_SaveSiteMapNode'
    DROP  Procedure  proc_cm_SaveSiteMapNode
END
GO

PRINT 'Creating Procedure proc_cm_SaveSiteMapNode'
GO

CREATE PROCEDURE [dbo].[proc_cm_SaveSiteMapNode]
	@pNodeId uniqueidentifier
	,@pNodeTitle nvarchar(255)
	,@pNodeUrl nvarchar(1024) = null
	,@pNodeCd nvarchar(20) = null
	,@pNodeDescription nvarchar(2048) = null
	,@pRole varchar(50) = null
	,@pUseGenericPageInd bit = 0
	,@pGenericPageType varchar(50) = null
	,@pAdminUsers nvarchar(1024) = null
AS
BEGIN
	UPDATE
		[dbo].[tbl_sitemap]
	SET
		[node_title] = @pNodeTitle
		,[node_url] = @pNodeUrl
		,[node_cd] = @pNodeCd
		,[node_description] = @pNodeDescription
		,[role] = @pRole
		,[use_generic_page_ind] = @pUseGenericPageInd
		,[generic_page_type] = @pGenericPageType
		,[admin_users] = @pAdminUsers
	WHERE 
		[node_id] = @pNodeId
END
GO

GRANT EXEC ON dbo.proc_cm_SaveSiteMapNode TO PUBLIC
GO
